Practical Design Patterns for Java Developers by Miroslav Wengner

Practical Design Patterns for Java Developers by Miroslav Wengner

Author:Miroslav Wengner
Language: eng
Format: epub
Publisher: Packt
Published: 2023-11-15T00:00:00+00:00


Figure 4.2 – The UML class diagram shows how the Engine interface bridges access to a specific implementation

The engines already behave differently, and due to the bridge they may continue evolving (Example 4.6):

class DieselEngine implements Engine{ ... @Override public void turnOff() {...} } class PetrolEngine implements Engine{ ... @Override public void turnOff() { selfCheck(); ... } private void selfCheck(){ ...} }

Example 4.6 – The engines differ in implementation

The vehicle abstraction does not have any engine implementation details, which may vary even in the class hierarchy. The vehicle only needs to rely on the provided interface.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.